<% if @cases.empty? %>
	<div class="tr8n_txtl" style="font-style:italic; font-size: 10px; color: grey;">
	  <%=tra("There are no language cases defined for this language.")%>
	  <%=link_to_function(tra("Click here to add language cases."), "addLanguageCase('#{@cases.size}')")%>
	</div>
	
<% else %>

  <% @cases.each_with_index do |lcase, index| %>
      <div style="padding:5px; border: 1px dotted #ccc; margin-top:5px; margin-bottom:0px; background-color:#F1F4F9;">
	        <table style="display:inline">
	        	<tr>
	        		<td class="tr8n_txtl" style="vertical-align:top;width:1%; padding-right:3px;">
	              <%=tr8n_toggler_tag("language_case_rules_#{index}", "", false)%>			
	        		</td>
							<td>
				        <div class="tr8n_txtl" id="language_case_labels_<%=index%>" style="<%='display:none' if lcase.native_name.blank? %>">
				          <strong><%= lcase.native_name %></strong>
				          <span style="color:grey; font-size:10px;">
				            <% if lcase.application == 'phrase' %>
				              <%= tra("applied to the entire phrase of the token value") -%>
				            <% else %>
				              <%= tra("applied to every word in the token value") -%>
				            <% end %>
				          </span> 
				          <br>
				          <span style="color:grey; font-size:10px;" dir="ltr">
				            (::<%= lcase.keyword %>)
				            <%= lcase.description %> 
				          </span>
				        </div>
				        
				        <div class="tr8n_txtl" id="language_case_fields_<%=index%>" style="<%='display:none' unless lcase.native_name.blank? %>">
				          <span style="font-weight:bold;padding-left:5px;"><%=tra("Key:", "Language case key")%></span>
				          <%= text_field_tag("cases[#{index}][keyword]", lcase.keyword, :style => "width:50px;")%>
				          <span style="font-weight:bold;padding-left:5px;"><%=tra("Name:", "Language case name")%></span>
				          <%= text_field_tag("cases[#{index}][native_name]", lcase.native_name, :style => "width:100px;")%>
				          <span style="font-weight:bold;padding-left:5px;"><%=tra("Description:", "Language case description")%></span>
				          <%= text_field_tag("cases[#{index}][description]", lcase.description, :style => "width:220px;")%>
				          <span style="font-weight:bold;padding-left:5px;"><%=tra("Application:", "Language case description")%></span>
				          <%=select_tag("cases[#{index}][application]", tr8n_options_for_select(lcase.class.application_options, lcase.application), :style => "width:120px")%>
				        </div>
						</td>
						<td class="tr8n_txtr" style="vertical-align:top;white-space:nowrap;">
		          <% unless lcase.native_name.blank? %>  
		            <%=link_to_function(image_tag("tr8n/pencil.png"), "editLanguageCase('#{index}')", :id => "language_case_edit_link_#{index}")%>
		          <% end %>
		          <%=link_to_function(image_tag("tr8n/delete.png"), "deleteLanguageCase('#{index}')")%>							
						</td>
	      	</tr>  
	       </table>
      </div>              
				
	    <div id="language_case_rules_<%=index%>" style="display:none;padding:5px; border: 1px dotted #ccc; margin-top:0px; margin-bottom:5px; border-top: 0px; background-color:white;">
	        <%= render(:partial => "edit_language_case_rules", :locals => {:lcase => lcase, :case_index => index}) %>
			</div>		 
				
  <% end %>
	
  <div class="tr8n_txtl" style="color:grey; font-size:12px; padding-top:15px;">
	 <%=link_to_function(tra("+ Add Language Case"), "addLanguageCase('#{@cases.size}')")%>
	</div>
	
	<div class="tr8n_txtl" style="color:grey; font-size:10px; padding-top:15px; padding-bottom:5px;">
	  <%=tra("Modifying the case keyword value will invalidate all translated values provided for the case.")%>
	</div>
<% end %>

